﻿namespace PhotobucketNet
{
    using System;

    public class UserToken : PhotobucketToken
    {
        private string _subdomain;
        private string _userApi;
        private string _userHomeUrl;
        private string _username;

        public UserToken()
        {
            this._username = string.Empty;
            this._subdomain = string.Empty;
            this._userHomeUrl = string.Empty;
            this._userApi = string.Empty;
        }

        public UserToken(string token, string secret, string username, string subdomain, string userHomeUrl) : base(token, secret)
        {
            this._username = string.Empty;
            this._subdomain = string.Empty;
            this._userHomeUrl = string.Empty;
            this._userApi = string.Empty;
            this.Username = username;
            this.Subdomain = subdomain;
            this.UserHomeUrl = userHomeUrl;
        }

        public override bool Equals(object obj)
        {
            UserToken token = obj as UserToken;
            return (((base.Equals(obj) && this.Username.Equals(token.Username)) && this.Subdomain.Equals(token.Subdomain)) && this.UserHomeUrl.Equals(token.UserHomeUrl));
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public string Subdomain
        {
            get
            {
                return this._subdomain;
            }
            set
            {
                this._subdomain = value;
                this._userApi = "http://" + this.Subdomain + "/";
            }
        }

        public string UserApi
        {
            get
            {
                return this._userApi;
            }
        }

        public string UserHomeUrl
        {
            get
            {
                return this._userHomeUrl;
            }
            set
            {
                this._userHomeUrl = value;
            }
        }

        public string Username
        {
            get
            {
                return this._username;
            }
            set
            {
                this._username = value;
            }
        }
    }
}

